package com.sailfish.springbootdemo.controller.db1;

import com.sailfish.springbootdemo.pojo.Result;
import com.sailfish.springbootdemo.service.db1.LineBaseParamService;
import com.sailfish.springbootdemo.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/lineBaseParam")
public class LineBaseParamController {

    @Autowired
    private LineBaseParamService lineBaseParamService;

    @PostMapping("/getAllLineBaseParamByType")
    public Result getAllLineBaseParamByType(String searchValue, Integer lineBaseBigTypeId, Integer lineBaseSmallTypeId) {
        try {
            return ResultUtil.success(lineBaseParamService.getAllLineBaseParamByType(searchValue, lineBaseBigTypeId, lineBaseSmallTypeId));
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.error(500, e.getMessage(), e.getMessage(), null);
        }
    }
}
